<template>
  <div>
    <van-nav-bar
      title="提交订单"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <van-cell title="请添加地址" is-link to="/addressedit" />
    <van-card
      :num="goods.num"
      :price="goods.originprice"
      :title="goods.proname"
      :thumb="goods.img1"
      v-for="goods in confirmgoods"
      :key="goods.cartid"
    />
  </div>
</template>

<script>
import { deleteCartItem,confirmOrder } from "../api/order";
import { doCartList } from "../api/cart";
export default {
  components: {},
  data() {
    return {
      confirmgoods: [],
    };
  },
  created() {
    console.log(this.$route.params.time);
    confirmOrder({ userid: localStorage.getItem("userid"),time:this.$route.params.time }).then((res) => {
      console.log(res);
      // this.confirmgoods = res.data.data;
    });
    doCartList({ userid: localStorage.getItem("userid") }).then((res) => {
      console.log(res.data);
      this.confirmgoods = res.data.data;
    });
    this.confirmgoods = this.$store.state.confirmbuy
  },     
  mounted(){
    deleteCartItem({ userid: localStorage.getItem("userid") }).then((res) => {
      console.log(res.data);
      // this.confirmgoods = res.data.data;
    });
  },
  methods: {
    onClickLeft(){
      this.$router.back()
    }
  },
};
</script>

<style>
</style>